﻿using System.Text.RegularExpressions;

namespace Annotations
{
    /// <summary>
    /// Determines what regular expression pattern the property value must match
    /// </summary>
    public class RegexAttribute : PropertyAttribute
    {
        #region Constructors

        public RegexAttribute(string pattern, RegexOptions options = RegexOptions.None)
        {
            _pattern = pattern;
            _options = options;
        }

        #endregion

        #region Properties

        public string Pattern
        {
            get { return _pattern; }
        }

        public RegexOptions Options
        {
            get { return _options; }
        }  

        #endregion

        #region Fields

        private readonly string _pattern;
        private readonly RegexOptions _options;

        #endregion
    }
}
